var express = require('express');
var fs =  require('fs');
var path = require('path');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.post('/img', function ( req, res) {
  fs.readFile(path.resolve(__dirname, '../public/images/1.jpg'), (err, file) => {
    res.write(file, 'binary');
    res.end();
  })
})

module.exports = router;
